// Fill out your copyright notice in the Description page of Project Settings.

#include "WorldJunctionParts.h"
#include "WorldEntityReferencing.h"

WORLD_ENTITY_META_DEFINE(FWorldJunctionController, FWorldEntityPart);

FWorldJunctionController::FWorldJunctionController()
	: Super()
	, ID(this)
	, Type(this, "")
	, Sequence(this, 0)
{}

FWorldJunctionController::FWorldJunctionController(FWorldEntityPart* parent, const pugi::xml_node& elem)
	: Super(parent, elem)
	, ID(this, elem, "id")
	, Type(this, "", elem, "type")
	, Sequence(this, 0, elem, "sequence")
{}

FWorldJunctionController::~FWorldJunctionController()
{}

void FWorldJunctionController::Resolve(FWorldEntityReferencing& referencing)
{
	Super::Resolve(referencing);
	referencing
		.Resolve(ID);
}

WORLD_ENTITY_META_DEFINE(FWorldJunctionPriority, FWorldEntityPart);

FWorldJunctionPriority::FWorldJunctionPriority()
	: Super()
	, High(this)
	, Low(this)
{}

FWorldJunctionPriority::FWorldJunctionPriority(FWorldEntityPart* parent, const pugi::xml_node& elem)
	: Super(parent, elem)
	, High(this, elem, "high")
	, Low(this, elem, "low")
{}

FWorldJunctionPriority::~FWorldJunctionPriority()
{}

void FWorldJunctionPriority::Resolve(FWorldEntityReferencing& referencing)
{
	Super::Resolve(referencing);
	referencing
		.Resolve(High)
		.Resolve(Low);
}

WORLD_ENTITY_META_DEFINE(FWorldJunctionLaneLink, FWorldEntityPart);

FWorldJunctionLaneLink::FWorldJunctionLaneLink()
	: Super()
	, From(this, 0)
	, To(this, 0)
{}

FWorldJunctionLaneLink::FWorldJunctionLaneLink(FWorldEntityPart* parent, const pugi::xml_node& elem)
	: Super(parent, elem)
	, From(this, 0, elem, "from")
	, To(this, 0, elem, "to")
{}

FWorldJunctionLaneLink::~FWorldJunctionLaneLink()
{}

WORLD_ENTITY_META_DEFINE(FWorldJunctionConnection, FWorldEntityPart);

FWorldJunctionConnection::FWorldJunctionConnection()
	: Super()
	, ID(this, "")
	, IncomingRoad(this)
	, ConnectingRoad(this)
	, ContactPoint(this, FWorldContactPoint::Start)
	, LaneLink(this)
{}

FWorldJunctionConnection::FWorldJunctionConnection(FWorldEntityPart* parent, const pugi::xml_node& elem)
	: Super(parent, elem)
	, ID(this, "", elem, "id")
	, IncomingRoad(this, elem, "incomingRoad")
	, ConnectingRoad(this, elem, "connectingRoad")
	, ContactPoint(this, FWorldContactPoint::Start, elem, "contactPoint")
	, LaneLink(this, elem, "laneLink")
{}

FWorldJunctionConnection::~FWorldJunctionConnection()
{}

void FWorldJunctionConnection::Resolve(FWorldEntityReferencing& referencing)
{
	Super::Resolve(referencing);
	referencing
		.Resolve(IncomingRoad)
		.Resolve(ConnectingRoad)
		.Resolve(LaneLink);
}
